<?php echo $this->headTitle('Add product'); ?>

<?php
$productForm->setAttribute('action', $this->url('product-admin/doaction', array('controller' => 'product-admin-controller', 'action' => 'add-product')));
$productForm->setAttribute('class', 'form-horizontal');
$productForm->prepare();
?>

<?php echo $this->form()->openTag($productForm); ?>

<div class="form-group">
    <?php echo $this->formLabel($productForm->get('product_name')); ?>
    <div class="col-md-4">
        <?php echo $this->formInput($productForm->get('product_name')); ?>
        <?php if ($this->formElementErrors($productForm->get('product_name'))) { ?>
            <div class="alert-danger" style="margin-top: 10px;">
                <?php echo $this->formElementErrors($productForm->get('product_name')); ?>
            </div>
        <?php } ?>
    </div>
</div>
<div class="form-group">
    <?php echo $this->formLabel($productForm->get('product_image')); ?>
    <div class="col-md-4">
        <?php echo $this->formFile($productForm->get('product_image')); ?>
        <?php if ($this->formElementErrors($productForm->get('product_image'))) { ?>
            <div class="alert-danger" style="margin-top: 10px;">
                <?php echo $this->formElementErrors($productForm->get('product_image')); ?>
            </div>
        <?php } ?>
    </div>
</div>
<div class="form-group">
    <?php echo $this->formLabel($productForm->get('product_price')); ?>
    <div class="col-md-4">
        <?php echo $this->formInput($productForm->get('product_price')); ?>
        <?php if ($this->formElementErrors($productForm->get('product_price'))) { ?>
            <div class="alert-danger" style="margin-top: 10px;">
                <?php echo $this->formElementErrors($productForm->get('product_price')); ?>
            </div>
        <?php } ?>
    </div>
</div>
<div class="form-group">
    <?php echo $this->formLabel($productForm->get('product_price_sale_of')); ?>
    <div class="col-md-4">
        <?php echo $this->formInput($productForm->get('product_price_sale_of')); ?>
        <?php if ($this->formElementErrors($productForm->get('product_price_sale_of'))) { ?>
            <div class="alert-danger" style="margin-top: 10px;">
                <?php echo $this->formElementErrors($productForm->get('product_price_sale_of')); ?>
            </div>
        <?php } ?>
    </div>
</div>
<div class="form-group">
    <?php echo $this->formLabel($productForm->get('product_type')); ?>
    <div class="col-md-4">
        <?php echo $this->formSelect($productForm->get('product_type')->setValueOptions($productTypeOption)); ?>
    </div>
</div>
<div class="form-group">
    <?php echo $this->formLabel($productForm->get('product_category_id')); ?>
    <div class="col-md-4">
        <?php echo $this->formSelect($productForm->get('product_category_id')->setAttribute('onChange',"productController.setTextToHiddenInput(this.id, 'product_category_name');")); ?>
        <?php if ($this->formElementErrors($productForm->get('product_category_id'))) { ?>
            <div class="alert-danger" style="margin-top: 10px;">
                <?php echo $this->formElementErrors($productForm->get('product_category_id')); ?>
            </div>
        <?php } ?>
    </div>
</div>
<div class="form-group">
    <?php echo $this->formLabel($productForm->get('product_maker_maker_id')); ?>
    <div class="col-md-4">
        <?php echo $this->formSelect($productForm->get('product_maker_maker_id')->setAttribute('onChange',"productController.setTextToHiddenInput(this.id, 'product_maker_maker_name');")); ?>
        <?php if ($this->formElementErrors($productForm->get('product_maker_maker_id'))) { ?>
            <div class="alert-danger" style="margin-top: 10px;">
                <?php echo $this->formElementErrors($productForm->get('product_maker_maker_id')); ?>
            </div>
        <?php } ?>
    </div>
</div>
<div class="form-group">
    <?php echo $this->formLabel($productForm->get('product_spec_content')); ?>
    <div class="col-sm-10">
        <?php echo $this->formTextarea($productForm->get('product_spec_content')); ?>
    </div>
</div>
<div class="form-group">
    <?php echo $this->formLabel($productForm->get('product_content_detail')); ?>
    <div class="col-sm-10">
        <?php echo $this->formTextarea($productForm->get('product_content_detail')); ?>
    </div>
</div>
<?php echo $this->formHidden($productForm->get('product_id'));?>
<?php echo $this->formHidden($productForm->get('action_type'));?>
<?php echo $this->formHidden($productForm->get('product_maker_maker_name'));?>
<?php echo $this->formHidden($productForm->get('product_category_name'));?>
<div class="form-group">
    <div class="col-sm-offset-2 col-sm-10">
        <?php echo $this->formSubmit($productForm->get('save_product')); ?>
    </div>
</div>
<?php echo $this->form()->closeTag(); ?>


